package com.jixi.controller;

import com.jixi.common.result.Result;
import com.jixi.pojo.dto.CozeChatDto;
import com.jixi.pojo.vo.CozeChatMessageVo;
import com.jixi.service.EducationCozeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("/education/coze")
public class CozeController {
	
	@Autowired
	private EducationCozeService educationCozeService;
	
	/**
	 * 发起对话
	 *
	 * @param cozeChatDto 用户输入
	 * @return 对话信息
	 */
	@PostMapping("/chat/start")
	public Result<CozeChatMessageVo> startChat(@RequestBody CozeChatDto cozeChatDto) {
		return educationCozeService.startCozeChat(cozeChatDto);
	}
	
	/**
	 * 检查对话状态/获取对话信息
	 *
	 * @param conversationId 会话ID
	 * @param chatId         对话ID
	 * @return 对话信息
	 */
	@GetMapping("/chat/message")
	public Result<CozeChatMessageVo> getChatMessage(String conversationId, String chatId) {
		return educationCozeService.getCozeChatMessage(conversationId, chatId);
	}
	
}
